@extends('layouts.admin.application')

@section('content')
    <div class="main-content">
        <div class="col-xs-12">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="#">首页</a></li>
                    <li><a href="">权限管理</a></li>
                    <li class="active">编辑权限</li>
                </ul>
            </div>

            @include('layouts.partials._flash')

            <form class="form-horizontal" role="form" action="{{route('system.permission.update', $permission->id)}}"
                  method="post"
                  style="margin-top: 20px;">

                {{csrf_field()}}
                {{method_field('PUT')}}

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">上级菜单</label>

                    <div class="col-sm-9">
                        <select class="form-control" style="width: 380px;" name="parent_id">
                            @if($permission->parent_id == 0)
                                <option value="0">顶级菜单</option>
                            @else
                                @foreach($permissions as $p)
                                    <option value="{{$p->id}}"
                                            @if($p->id == $permission->parent_id) selected @endif>
                                        {{$p->label}}
                                    </option>
                                @endforeach
                            @endif
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">菜单名称</label>

                    <div class="col-sm-9">
                        <input type="text" name="label" value="{{$permission->label}}" placeholder="菜单名称，你懂得~"
                               class="col-xs-10 col-sm-5">
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">图标</label>

                    <div class="col-sm-9">
                        <input type="text" name="icon" value="{{$permission->icon}}" placeholder="请输入图标的 class"
                               class="col-xs-10 col-sm-5">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">权限名称</label>

                    <div class="col-sm-9">
                        <textarea id="description" name="name" cols="50" rows="7"
                                  placeholder="请输入权限名称">{{$permission->name}}</textarea>

                    </div>
                </div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>保存</button>
                        &nbsp; &nbsp; &nbsp;
                        <a class="btn" onclick="javascript:history.back(-1);return false;"><i
                                    class="icon-undo bigger-110"></i>返回</a>
                    </div>
                </div>
            </form>
        </div>

    </div>
@endsection
